﻿﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//Made by Mikkel & Lasse
namespace DataTier
{
    public class Customers : DataTier.ICustomers 
    {

        public List<Customer> customers { get; set; }

        public Customers()
        {
            customers = new List<Customer>();
        }

        public void AddCustomer(string phoneNum, string name, string address, string zipCode, string email, string edu, DateTime birthday, string interests, string sex)
        {

           customers.Add(new Customer { CustomerPhoneNumber = phoneNum, CustomerName = name, CustomerMemberSince = DateTime.Now, CustomerEmail = email, CustomerEducation = edu, CustomerAddress = address, CustomerBirthday = birthday, CustomerInterests = interests, CustomerSex = sex, 
            CustomerZipCode = zipCode});
        }


        public void UpdateCustomer(string phoneNum, string name, string address, string zipCode, 
            string email, string edu, DateTime birthday, string interests, string sex)
        {
            Customer c = new Customer(); 
            c= FindCustomer(phoneNum);
            c.CustomerPhoneNumber = phoneNum;
            c.CustomerName = name;
            c.CustomerAddress = address;
            c.CustomerZipCode = zipCode;
            c.CustomerEmail = email;
            c.CustomerEducation = edu;
            c.CustomerBirthday = birthday;
            c.CustomerInterests = interests;
        }

        public Customer FindCustomer(string phoneNum)
        {
            Customer foundCust = new Customer();
            foreach(Customer c in customers)
            {
                if (phoneNum == c.CustomerPhoneNumber)
                {

                    foundCust = c;
                }
            }
            return foundCust; 
        }

        public void DeleteCustomer(string phoneNum)
        {
            customers.Remove(FindCustomer(phoneNum));
        }

        public void DeleteCustomer(Customer c) 
        {
            customers.Remove(c);
        }


        public DateTime Birthday { get; set; }

        
    }
}

